#include<stdio.h>
#include<sys/types.h>
#include<unistd.h>
#include<sys/wait.h> 
#include<stdlib.h>


int main()
{
  pid_t id = fork();

  if(id<0)
  {
    printf("hello fork error\n");
  }
  else if( id == 0)
  {
    //child;
    while(1)
    {
      printf("child:-->  father: pid：%d , ppid:%d\n",getpid(), getppid());
      //sleep(1);
      exit(0);
    }
  }
  else
  {
    while(1)
    {
      printf("father:-->  father: pid：%d , ppid:%d \n",getpid(), getppid());
      //sleep(2);
      exit(0);
    }
  }
  return 0;
}
